package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.MstnCustomerMapper;
import com.ruoyi.system.domain.MstnCustomer;
import com.ruoyi.system.service.IMstnCustomerService;

/**
 * 客户Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-07-18
 */
@Service
public class MstnCustomerServiceImpl implements IMstnCustomerService 
{
    @Autowired
    private MstnCustomerMapper mstnCustomerMapper;

    /**
     * 查询客户
     * 
     * @param customerId 客户主键
     * @return 客户
     */
    @Override
    public MstnCustomer selectMstnCustomerByCustomerId(Long customerId)
    {
        return mstnCustomerMapper.selectMstnCustomerByCustomerId(customerId);
    }

    /**
     * 查询客户列表
     * 
     * @param mstnCustomer 客户
     * @return 客户
     */
    @Override
    public List<MstnCustomer> selectMstnCustomerList(MstnCustomer mstnCustomer)
    {
        return mstnCustomerMapper.selectMstnCustomerList(mstnCustomer);
    }

    /**
     * 新增客户
     * 
     * @param mstnCustomer 客户
     * @return 结果
     */
    @Override
    public int insertMstnCustomer(MstnCustomer mstnCustomer)
    {
        mstnCustomer.setCreateTime(DateUtils.getNowDate());
        return mstnCustomerMapper.insertMstnCustomer(mstnCustomer);
    }

    /**
     * 修改客户
     * 
     * @param mstnCustomer 客户
     * @return 结果
     */
    @Override
    public int updateMstnCustomer(MstnCustomer mstnCustomer)
    {
        mstnCustomer.setUpdateTime(DateUtils.getNowDate());
        return mstnCustomerMapper.updateMstnCustomer(mstnCustomer);
    }

    /**
     * 批量删除客户
     * 
     * @param customerIds 需要删除的客户主键
     * @return 结果
     */
    @Override
    public int deleteMstnCustomerByCustomerIds(Long[] customerIds)
    {
        return mstnCustomerMapper.deleteMstnCustomerByCustomerIds(customerIds);
    }

    /**
     * 删除客户信息
     * 
     * @param customerId 客户主键
     * @return 结果
     */
    @Override
    public int deleteMstnCustomerByCustomerId(Long customerId)
    {
        return mstnCustomerMapper.deleteMstnCustomerByCustomerId(customerId);
    }
}
